package com.plian.system.dao.fr.budgetadjustment;

import com.plian.Tools.pagedata.PageData;
import com.plian.system.dao.DaoSupport;
import com.plian.system.model.page.Page;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

@Component
public class BudgetAdjustmentDao {

    @Resource(name = "daoSupport")
    private DaoSupport dao;

    /**
     * 新增
     *
     * @param pd
     * @throws Exception
     */
    public void save(PageData pd) throws Exception {
        dao.save("GsalarySlipMapper.save", pd);
    }

    /*
    查询主表
     */
    public PageData findzb(PageData pd) throws Exception {
        return (PageData) dao.findForObject("BudgetAdjustmentMapper.findzb", pd);
    }
    /*
        查询主表
         */
    public PageData findZbById(PageData pd) throws Exception {
        return (PageData) dao.findForObject("BudgetAdjustmentMapper.findZbById", pd);
    }
    /**
     * 保存主表
     *
     * @param pd
     * @throws Exception
     */
    public void savezb(PageData pd) throws Exception {
        dao.save("BudgetAdjustmentMapper.savezb", pd);
    }

    /**
     * 保存link表
     */
    public void savelink(PageData pd) throws Exception {
        dao.save("AdjustmentLinkMapper.save", pd);
    }

    /*
    删除link表
     */
    public void dellink(PageData pd) throws Exception {
        dao.delete("AdjustmentLinkMapper.delete", pd);
    }

    /*
    按ORG_ID查找colunm表
     */
    public List<PageData> findcolumn(PageData pd) throws Exception {
        return (List<PageData>) dao.findForList("AdjustmentLinkMapper.findcolumn", pd);
    }

    /**
     * 保存值表
     */
    public void savevalue(List<PageData> list) throws Exception {
        dao.save("AdjustmentValueMapper.savevalue", list);
    }
    /**
     * 财务取数
     */
    public List<PageData> getFinancialDate(PageData pd) throws Exception {
        return (List<PageData>) dao.findForList("AdjustmentValueMapper.getFinancialDate", pd);
    }
    /**
     * 财务取数
     */
    public List<PageData> getGroupFinancialDate(PageData pd) throws Exception {
        return (List<PageData>) dao.findForList("AdjustmentValueMapper.getGroupFinancialDate", pd);
    }
    /**
     * 查询值表
     */
    public List<PageData> findvalue(PageData pd) throws Exception {
        return (List<PageData>) dao.findForList("AdjustmentValueMapper.findvalue", pd);
    }
    /**
     * 查询值表
     */
    public List<PageData> addvalue(PageData pd) throws Exception {
        return (List<PageData>) dao.findForList("AdjustmentValueMapper.addvalue", pd);
    }

    /**
     * 查询值表
     */
    public List<PageData> overvalue(PageData pd) throws Exception {
        return (List<PageData>) dao.findForList("AdjustmentValueMapper.overvalue", pd);
    }

    /**
     * 差额计算
     */
    public List<PageData> differencevalue(PageData pd) throws Exception {
        return (List<PageData>) dao.findForList("AdjustmentValueMapper.differencevalue", pd);
    }
    /*
     * 查询上年度ID
     * */
    public String lastYearId(PageData pd) throws Exception {
        return (String) dao.findForObject("AdjustmentValueMapper.lastYearId", pd);
    }

    /*
     * 查询上年度ID
     * */
    public PageData findLinkById(PageData pd) throws Exception {
        return (PageData) dao.findForObject("AdjustmentLinkMapper.findLinkById", pd);
    }

    /*
     * 查询上年度ID
     * */
    public List<PageData> findLinksById(PageData pd) throws Exception {
        return (List<PageData>) dao.findForList("AdjustmentLinkMapper.findLinksById", pd);
    }

    /*
     * 查询上年度ID
     * */
    public String findExtraById(PageData pd) throws Exception {
        return (String) dao.findForObject("AdjustmentLinkMapper.findExtraById", pd);
    }

    /*
    上报
     */
    public void refer(PageData pd) throws Exception {
        dao.update("BudgetAdjustmentMapper.update", pd);
    }
    /*
  上报
   */
    public void updateReason(PageData pd) throws Exception {
        dao.update("BudgetAdjustmentMapper.updateReason", pd);
    }
    /*
      改变主表勾选状态
       */
    public void updatePassStatus(PageData pd) throws Exception {
        dao.update("BudgetAdjustmentMapper.updatePassStatus", pd);
    }
    /*
   改变主表勾选状态
    */
    public void changCheck(PageData pd) throws Exception {
        dao.update("BudgetAdjustmentMapper.updateCheckStatus", pd);
    }
    /*
   改变单表勾选状态
    */
    public void changLinkCheck(PageData pd) throws Exception {
        dao.update("AdjustmentLinkMapper.updateLinkCheckStatus", pd);
    }

    /*
  改变主表勾选状态
   */
    public void changDiffCheck(PageData pd) throws Exception {
        dao.update("BudgetAdjustmentMapper.updateDiffCheckStatus", pd);
    }
    /*
   改变单表勾选状态
    */
    public void changDiffLinkCheck(PageData pd) throws Exception {
        dao.update("AdjustmentLinkMapper.updateLinkDiffCheckStatus", pd);
    }
    /**
     * 删除
     *
     * @param
     * @throws Exception
     */
    public void delete(PageData pd) throws Exception {
        dao.delete("BudgetAdjustmentMapper.delete", pd);
    }
    /*
查询org表名
 */
    public PageData findorgname(PageData pd) throws Exception {
        return (PageData) dao.findForObject("BudgetAdjustmentMapper.findorgname", pd);
    }
    /*
   查询org是否需要合并
    */
    public PageData findOrgMes(PageData pd) throws Exception {
        return (PageData) dao.findForObject("BudgetAdjustmentMapper.findOrgMes", pd);
    }
    /**
     * 修改
     *
     * @param pd
     * @throws Exception
     */
    public void edit(PageData pd) throws Exception {
        dao.update("GsalarySlipMapper.edit", pd);
    }


    public List<PageData> list_bb(Page page) throws Exception {
        return (List<PageData>) dao.findForList("BudgetAdjustmentMapper.datalistPage_bb", page);
    }

    public List<PageData> list_bball(Page page) throws Exception {
        return (List<PageData>) dao.findForList("BudgetAdjustmentMapper.datalistPage_bball", page);
    }

    /**
     * 列表(全部)
     *
     * @param pd
     * @throws Exception
     */
    @SuppressWarnings("unchecked")
    public List<PageData> listAll(PageData pd) throws Exception {
        return (List<PageData>) dao.findForList("BudgetAdjustmentMapper.listAll", pd);
    }
    /**
     * 汇总明细
     *
     * @param pd
     * @throws Exception
     */
    public List<PageData> listDeatil(PageData pd) throws Exception {
        return (List<PageData>) dao.findForList("AdjustmentValueMapper.listDeatil", pd);
    }
    /**
     * 列表(全部)
     *
     * @param pd
     * @throws Exception
     */
    public List<PageData> listAllOrg(PageData pd) throws Exception {
        return (List<PageData>) dao.findForList("BudgetAdjustmentMapper.listAllOrg", pd);
    }

    public List<PageData> findByIds(PageData pd) throws Exception {
        return (List<PageData>) dao.findForList("BudgetAdjustmentMapper.findByIds", pd);
    }

    public List<String> findByUnitAndYear(PageData pd) throws Exception {
        return (List<String>) dao.findForList("BudgetAdjustmentMapper.findByUnitAndYear", pd);
    }

    public PageData findunitById(PageData pd) throws Exception {
        return (PageData) dao.findForObject("BudgetAdjustmentMapper.findunitById", pd);
    }

    public PageData findOrgByName(PageData pd) throws Exception {
        return (PageData) dao.findForObject("BudgetAdjustmentMapper.findOrgByName", pd);
    }

}
